<template>
    <div v-if="!isShop">
        <van-tabbar v-model="active">
            <van-tabbar-item to="/" name="index" icon="home-o">主页</van-tabbar-item>
            <van-tabbar-item to="/records" name="records" icon="records">点餐</van-tabbar-item>
            <van-tabbar-item to="/user" name="user" icon="user-o">我的</van-tabbar-item>
        </van-tabbar>
    </div>
    <div v-else>
        <van-tabbar v-model="active">
            <van-tabbar-item to="/handleorders" name="handleorders" icon="orders-o">订单处理</van-tabbar-item>
            <van-tabbar-item to="/handleshop" name="handleshop" icon="records">店铺操作</van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script setup>
import { ref } from 'vue';
const userInfoCookie = useCookie('userInfo')
const isShop = ref(false)
const active = ref('index');
const currentRouteName = useTabState()

function init() {
    if (userInfoCookie.value)
        isShop.value = userInfoCookie.value.type == 1 ? false : true
    active.value = currentRouteName
}
init()
</script>
